﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
   
    
    <script >
        var dojoConfig = { baseUrl: "itfanr/", packages: [{name:"test",location:"test"}]};
    </script>
    <script src="dojo/dojo/dojo.js"></script>
    <script >
  
      //  require(
     //  ["dojo/ready", "test/person"],
      // function (ready, person) {
       ////    ready(function () {
          //     var id = "selected_text";
           //    var person1 = new person("dfdsfd");
              // alert(person1.name);
         //  });
     //  });
        require(["dojo/on", "dojo/dom", "dojo/dom-style", "dojo/request", "dojo/mouse", "dojo/domReady!"],
    function (on, dom, domStyle,request,mouse) {
        var myButton = dom.byId("myButton");
        var myButton2 = dom.byId("myButton2"),
            myDiv = dom.byId("myDiv");

        on(myButton2, "click", function (evt) {
            request.get("TextFile.txt").then(
            function (response) {
                myDiv.innerHTML = "<pre>" + response + "</pre>";
            },
            function (error) {
                myDiv.innerHTML = "<div class=\"error\">" + error + "<div>";
                }
                );
        });

        on(myButton, "click", function (evt) {
            domStyle.set(myDiv, "backgroundColor", "blue");
        });
        on(myDiv, mouse.enter, function (evt) {
            domStyle.set(myDiv, "backgroundColor", "red");
        });
        on(myDiv, mouse.leave, function (evt) {
            domStyle.set(myDiv, "backgroundColor", "");
        });
    });

    
    </script>



    
</head>
<body>
    <h1 id="selected_text">Hello</h1>
    <button id="myButton">单击ON</button>
    <button id="myButton2">单击Request</button>
    <div id="myDiv">myDiv</div>
</body>
</html>
